using System.Collections;
using System.Collections.Generic;
using RecommendedProduct;
using UnityEngine;

public class SelectStandartUI : MonoBehaviour
{
	public const int COUNT_BUTTONS = 8;

	[SerializeField]
	private SelectableButtonController selectableButtonShopController;

	[SerializeField]
	private GameModesUI controllerSelectMode;

	[SerializeField]
	private SelectableButtonShop exampleShopButton;

	[SerializeField]
	private SelectableButtonShop exampleShopButton2;

	[SerializeField]
	private MarketMiniProductInfo transportInfoPanel;

	private SelectableButtonShop _exampleShopButton;

	public SelectableButtonController SelectableButtonShopController
	{
		get
		{
			return selectableButtonShopController;
		}
	}

	public MarketMiniProductInfo TransportInfoPanel
	{
		get
		{
			return transportInfoPanel;
		}
	}

	public SelectableButtonShop ExampleShopButton
	{
		get
		{
			if (_exampleShopButton == null)
			{
				_exampleShopButton = ((!GameModeManager.instance.IsWide) ? exampleShopButton : exampleShopButton2);
			}
			return _exampleShopButton;
		}
	}

	private void OnEnable()
	{
		Reinit();
	}

	public void Reinit()
	{
		StartCoroutine(InitShopButton());
	}

	private IEnumerator InitShopButton()
	{
		TypeGame typeGame = controllerSelectMode.SelectableButtonController.GetSelectableButton().ModeInfo.typeGame;
		List<Product> products = ProductStaticManager.GetInstance().GetProduct(typeGame);
		for (int i = 0; i < selectableButtonShopController.allButtons.Count; i++)
		{
			SelectableButtonShop tmpButton = selectableButtonShopController.allButtons[i] as SelectableButtonShop;
			tmpButton.InitButton(products[i]);
		}
		if (selectableButtonShopController.allButtons[0] != null)
		{
			selectableButtonShopController.allButtons[0].Select(true);
		}
		yield return null;
	}
}
